<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<title>城市物流配送系统 </title>
	<?php include('source.php'); ?>

</head>
<body>
<!-- 导航栏 -->	

 <?php include('menu.php'); ?>
<div class="container" style="width: 100%;padding-top:20px;">
	
	<?php include('side.php'); ?>
	<div class="col-sm-10">
		<div class="form-horizontal" id="form">
            	<div class="form-group">
				    <label for="inputEmail3" class="col-sm-2 control-label">姓名：</label>
				    <div class="col-sm-4">
				      <input name="dname" type="text" class="form-control" id="inputEmail3" placeholder="">
				    </div>
					<label for="inputEmail3" class="col-sm-2 control-label">年龄：</label>
				    <div class="col-sm-4">

						  <input name="dage" type="text" class="form-control" id="inputEmail3" placeholder="">

				    </div>
			  	</div> 
            	<div class="form-group">
				    <label for="inputEmail3" class="col-sm-2 control-label">性别：</label>
				    <div class="col-sm-4">
				     	 <select name="dmale" class="form-control">
						  <option val="男">男</option>
							<option val="女">女</option>
						</select>
				    </div>
				    <label for="inputEmail3" class="col-sm-2 control-label">身份证号：</label>
				    <div class="col-sm-4">
				     	   <input name="dcredit" type="text" class="form-control" id="inputEmail3" placeholder="">

				    </div>
			  	</div>	

			  	<div class="form-group">
				    <label for="inputEmail3" class="col-sm-2 control-label">驾龄：</label>
				    <div class="col-sm-4">
				      <input name="driveAge" type="number" class="form-control" id="inputEmail3" placeholder="">
				    </div>
					  <label for="inputEmail3" class="col-sm-2 control-label">驾龄：</label>
				    <div class="col-sm-4">
				      <select name="bid" class="form-control">
						  <?php foreach ($bus as $item): ?>
						  		<option value="<?php echo $item->bid; ?>"><?php echo $item->bname; ?></option>
						  <?php endforeach ?>
						</select>
				    </div>
			  	</div> 		  	 
             
             
			  	<div class="form-group">
				    <label for="inputEmail3" class="col-sm-2 control-label"> </label>
				    <div class="col-sm-4">
				     	<button class="btn-primary" id="submit">添 加</button>
				    </div>
				    
			  	</div>
				<div class="form-group col-offset-2">
					 
				</div>
			</div>

	</div>
</div>
 
</body>
<script type="text/javascript" src="js/bootstrap/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="js/bootstrap/bootstrap-datetimepicker.zh-CN.js"></script>

<script>
	$('#submit').click(function(){
		console.log('click')
    if(bone.verify.check('#form')){
      var data = bone.verify.getData();

        $.ajax({
          url: SITE_URL+'/drivers/save',
          type: 'post',
          data: data,
          success: function(d){
            if(d.state){
              alert('添加成功')
            } else {
             alert('添加失败')
            }
          },
          error: function(){
           //bone.dialog.init('','发生错误，请重试');
          },
          dataType: 'json'
        })
    } else {
    	console.log('format wrong')
    }
  })
</script>
</html>